package se.lnu.axez.physics;

import se.lnu.axez.AxezContext;
import se.lnu.axez.IControl;
import se.lnu.axez.Transformation;
import se.lnu.axez.animation.Animation;
import se.lnu.axez.physics.bullet.PhysicsManager;
import se.lnu.axez.physics.bullet.RigidBody;
import android.view.MotionEvent;

public abstract class PhysicalControl implements IControl {
	@Override
	public void draw(AxezContext context) {
		getWrappedControl().draw(context);
	}

	@Override
	public void addAnimation(Animation<IControl> animation) {
		getWrappedControl().addAnimation(animation);
	}

	@Override
	public void onTouchEvent(MotionEvent motionEvent) {
		getWrappedControl().onTouchEvent(motionEvent);
	}

	@Override
	public Transformation getTransformation() {
		return getWrappedControl().getTransformation();
	}
	
	@Override
	public void init(AxezContext context) {
		getWrappedControl().init(context);
		initPhysics(context.getPhysicsManager());
	}

	protected abstract IControl getWrappedControl();
	protected abstract RigidBody initPhysics(PhysicsManager physicsManager);
}
